/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Clases;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author user
 */
@Entity
@Table(name = "personal")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Personal.findAll", query = "SELECT p FROM Personal p"),
    @NamedQuery(name = "Personal.findByIdPer", query = "SELECT p FROM Personal p WHERE p.idPer = :idPer")})
public class Personal implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_per")
    private String idPer;
    @JoinColumn(name = "id_ping", referencedColumnName = "ping")
    @ManyToOne(optional = false)
    private Tarjeta idPing;
    @JoinColumn(name = "id_login", referencedColumnName = "cod_user")
    @ManyToOne(optional = false)
    private Usuario idLogin;

    public Personal() {
    }

    public Personal(String idPer) {
        this.idPer = idPer;
    }

    public String getIdPer() {
        return idPer;
    }

    public void setIdPer(String idPer) {
        this.idPer = idPer;
    }

    public Tarjeta getIdPing() {
        return idPing;
    }

    public void setIdPing(Tarjeta idPing) {
        this.idPing = idPing;
    }

    public Usuario getIdLogin() {
        return idLogin;
    }

    public void setIdLogin(Usuario idLogin) {
        this.idLogin = idLogin;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPer != null ? idPer.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Personal)) {
            return false;
        }
        Personal other = (Personal) object;
        if ((this.idPer == null && other.idPer != null) || (this.idPer != null && !this.idPer.equals(other.idPer))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Clases.Personal[ idPer=" + idPer + " ]";
    }
    
}
